package com.yao.utils;

import com.yao.VO.ResultVO;

/**
 * User: 姚宏武
 * Date: 2017/11/17
 * Time: 10:03
 * Email：401369870@qq.com
 * Description: http请求最外层对象的封装
 */
public class ResultVOUtil {

    /**
     * 封装成功返回的信息
     *
     * @param object
     * @return
     */
    public static ResultVO success(Object object) {
        ResultVO resultVO = new ResultVO();
        resultVO.setData(object);
        resultVO.setCode(0);
        resultVO.setMsg("成功");
        return resultVO;
    }


    public static ResultVO success() {
        return success(null);
    }


    /**
     * 封装错误的返回信息
     *
     * @param code
     * @param msg
     * @return
     */
    public static ResultVO error(Integer code, String msg) {
        ResultVO resultVO = new ResultVO();
        resultVO.setCode(code);
        resultVO.setMsg(msg);
        return resultVO;
    }

}
